import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { OnlineService } from './online.service';
import { QueryOnlineDto } from './dto/query-online.dto';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { RequirePermission } from 'src/decorator/reuqire-permission';

@Controller('online')
@ApiTags('在线用户')
@ApiBearerAuth()
export class OnlineController {
  constructor(private readonly onlineService: OnlineService) {}

  @Get()
  @ApiOperation({summary:'获取所有在线用户'})
  @RequirePermission("monitor:online:list")
  findAll(@Query() query:QueryOnlineDto) {
    return this.onlineService.findAll(query);
  }

  @Delete(':token')
  @ApiOperation({summary:'强退用户'})
  @RequirePermission("monitor:online:forceLogout")
  remove(@Param('token') token: string) {
    return this.onlineService.remove(token);
  }
}
